package com.woniuxy.service.impl;

import com.woniuxy.entity.Product;
import com.woniuxy.service.ProductService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 曾令忠
 * @Description:
 * @Date: 2020/7/17 0017-下午 2:27
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Override
    public List<Product> all() {
        List<Product> products = new ArrayList<Product>();
        products.add(new Product(1001, "手机1", 1234.2));
        products.add(new Product(1002, "手机2", 2234.3));
        products.add(new Product(1003, "手机3", 3234.4));
        products.add(new Product(1004, "手机4", 4234.5));
        return products;
    }

    @Override
    public Product findByPid(int pid) {
        return new Product(pid, "xxx", 1.23);
    }

    @Override
    public int deleteByPidAndPname(int pid, String pname) {
        System.out.println("删除商品");
        return 1;
    }

    @Override
    public int addProduct(Product product) {
        System.out.println("添加商品");
        return 1;
    }

    @Override
    public int update(Product product) {
        System.out.println("更新商品");
        return 0;
    }
}
